package com.loiot.baqi.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.loiot.baqi.pojo.WeiAccountQqGroupLeader;

/**
 * qq群主 访问层。
 * 
 * @author  xuyb 
 * @creation 2016-08-28
 */
@Repository("weiAccountQqGroupLeaderDao")
public class WeiAccountQqGroupLeaderDao extends SqlSessionDaoSupport{
    
    /**
     * 添加 qq群主
     * 
     * @param p 参数对象
     */
    public WeiAccountQqGroupLeader addWeiAccountQqGroupLeader(WeiAccountQqGroupLeader p)throws Exception {
        this.getSqlSession().insert("WeiAccountQqGroupLeader.addWeiAccountQqGroupLeader", p);
        return p;
    }
    
    /**
     * 修改 qq群主
     * 
     * @param p 参数对象
     */
    public void updateWeiAccountQqGroupLeader(WeiAccountQqGroupLeader p)throws Exception {
        this.getSqlSession().update("WeiAccountQqGroupLeader.updateWeiAccountQqGroupLeader", p);
    }
    
    /**
     * 修改 qq群主
     * 
     * @param p 参数对象
     */
    public void updateWeiAccountQqGroupLeader(HashMap<String,Object> pMap)throws Exception {
        this.getSqlSession().update("WeiAccountQqGroupLeader.updateWeiAccountQqGroupLeaderByMap", pMap);
    }
    
    
    
    /**
     * 删除  qq群主
     * 
     * @param id 主键
     */
    public void deleteWeiAccountQqGroupLeader(java.util.Date id)throws Exception {
        getSqlSession().delete("WeiAccountQqGroupLeader.deleteWeiAccountQqGroupLeader", id);
    }
    
    /**
     * 删除  qq群主
     * 
     * @param id 主键
     */
    public void deleteWeiAccountQqGroupLeader(WeiAccountQqGroupLeader p)throws Exception {
        getSqlSession().delete("WeiAccountQqGroupLeader.deleteWeiAccountQqGroupLeader", p);
    }
    
    /**
     * 获得  qq群主
     * 
     * @param id qq群主Id
     * 
     * @return 返回与ID匹配的qq群主
     */
    public WeiAccountQqGroupLeader getWeiAccountQqGroupLeaderById(java.util.Date id)throws Exception {
    	HashMap<String, Object> pMap = new HashMap<String, Object>();
    	pMap.put("updateTime", id);
    	return (WeiAccountQqGroupLeader) getSqlSession().selectOne("WeiAccountQqGroupLeader.getWeiAccountQqGroupLeaderById", pMap);
    }
    
    /**
     * 获得  qq群主
     * 
     * @param id qq群主Id
     * 
     * @return 返回与ID匹配的qq群主
     */
    public WeiAccountQqGroupLeader getWeiAccountQqGroupLeaderById(java.util.Date id,Long accountId)throws Exception {
    	HashMap<String, Object> pMap = new HashMap<String, Object>();
    	pMap.put("updateTime", id);
    	pMap.put("inPerson", accountId);
    	return (WeiAccountQqGroupLeader) getSqlSession().selectOne("WeiAccountQqGroupLeader.getWeiAccountQqGroupLeaderById", pMap);
    }
    
    /**
     * 获得  qq群主
     * 
     * @param id qq群主Id
     * 
     */
    public WeiAccountQqGroupLeader getWeiAccountQqGroupLeader(HashMap<String,Object> pMap)throws Exception {
    	return (WeiAccountQqGroupLeader) getSqlSession().selectOne("WeiAccountQqGroupLeader.queryWeiAccountQqGroupLeaderList", pMap);
    }
    
    /**
     * 获得  qq群主
     * 
     * @param name qq群主名称
     * 
     * @return 返回与NAME匹配的qq群主
     */
    public WeiAccountQqGroupLeader getWeiAccountQqGroupLeaderByName(String name)throws Exception {
        return null;
        //return (WeiAccountQqGroupLeader) getSqlSession().selectOne("WeiAccountQqGroupLeader.getWeiAccountQqGroupLeaderByName", name);
    }
    
    
    
    /**
     * 查询  qq群主列表条数
     * 
     * @param name qq群主名称
     * @return qq群主列表条数
     */
    
    public int getWeiAccountQqGroupLeaderListCount(HashMap<String,Object> pMap)throws Exception {
        return (Integer) getSqlSession().selectOne("WeiAccountQqGroupLeader.getWeiAccountQqGroupLeaderListCount", pMap);
    }

    /**
     * 查询 qq群主列表
     * 
     * @param name qq群主名称
     * @param skipResults 跳过的记录数
     * @param maxResults 最大的记录数
     * @return qq群主列表
     */
    public List<WeiAccountQqGroupLeader> queryWeiAccountQqGroupLeaderList(HashMap<String, Object> pMap, int skipResults, int maxResults)throws Exception {
    	pMap.put("skipResults", skipResults);
    	pMap.put("maxResults", maxResults);
        return getSqlSession().selectList("WeiAccountQqGroupLeader.queryWeiAccountQqGroupLeaderList", pMap);
    }
    
    /**
     * 查询 qq群主列表
     * 
     * @param pMap 参数列表
     */
    public List<WeiAccountQqGroupLeader> queryWeiAccountQqGroupLeaderList(HashMap<String, Object> pMap)throws Exception {
        return getSqlSession().selectList("WeiAccountQqGroupLeader.queryWeiAccountQqGroupLeaderList", pMap);
    }
    
    /**
     * 查询 qq群主列表
     * 
     * @return qq群主列表
     */
    public List<WeiAccountQqGroupLeader> queryWeiAccountQqGroupLeaderList()throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
        return getSqlSession().selectList("WeiAccountQqGroupLeader.queryWeiAccountQqGroupLeaderList",params);
    }
    
    /**
     * 查询 qq群主列表
     * 
     * @return qq群主列表
     */
    public List<WeiAccountQqGroupLeader> queryWeiAccountQqGroupLeaderList(WeiAccountQqGroupLeader p )throws Exception {
        return getSqlSession().selectList("WeiAccountQqGroupLeader.queryWeiAccountQqGroupLeaderList",p);
    }
    
    /**
     * 统计 qq群主列表
     * 
     * @return qq群主列表
     */
    public List<HashMap<String,Object>> statisticsWeiAccountQqGroupLeaderInfo(HashMap<String, Object> pMap )throws Exception {
    	List<HashMap<String,Object>> p = null; 
    	p =(List)getSqlSession().selectList("WeiAccountQqGroupLeader.statisticsWeiAccountQqGroupLeaderInfo",p);
    	return p;
    }
    
    
    
    

}
